const express = require('express');
const UserController = require('../../controller/admin/UserController');
var UserRouter = express.Router();
const multer = require('multer');
//尽量放在静态文件夹下  public/avataruploads/ 静态目录下自动生成
const upload = multer({ dest: 'public/avataruploads/' });

//登录接口
UserRouter.post('/adminapi/user/login', UserController.login);
//文件上传 single('file') file是前端接收图片二进制数据的属性
UserRouter.post('/adminapi/user/upload', upload.single('file'), UserController.upload); // 修改用户信息接口
UserRouter.post('/adminapi/user/add', upload.single('file'), UserController.add); // 创建用户信息接口
UserRouter.get('/adminapi/user/list', UserController.getList); //获取全部用户列表
UserRouter.get('/adminapi/user/list/:id', UserController.getList); //获取单个用户信息
UserRouter.put('/adminapi/user/list/:id', UserController.putList); //修改单个用户信息
UserRouter.delete('/adminapi/user/list/:id', UserController.delList); //删除

module.exports = UserRouter;
